﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CApAPPLimitError
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.AutomaticPathPlanner;
using System.Collections.Generic;
using System.ComponentModel;


namespace DnProcessSimulateCommands;

public class CApAPPLimitError : INotifyPropertyChanged
{
  private CApAPPLimitError.LimitErrorType m_errorType;
  private string m_errorMessage;
  private string m_invalidOperationName;
  private List<CApAPPWaypoint> m_waypointsWithTranslationError;
  private List<CApAPPWaypoint> m_waypointsWithRotationError;

  public CApAPPLimitError() => this.m_errorType = CApAPPLimitError.LimitErrorType.NO_ERROR;

  public CApAPPLimitError.LimitErrorType ErrorType
  {
    get => this.m_errorType;
    set
    {
      this.m_errorType = value;
      this.RaisePropertyChanged(nameof (ErrorType));
    }
  }

  public string ErrorMessageToDisplay
  {
    get
    {
      string messageToDisplay = "";
      switch (this.ErrorType)
      {
        case CApAPPLimitError.LimitErrorType.NO_ERROR:
          messageToDisplay = "";
          break;
        case CApAPPLimitError.LimitErrorType.TRANSLATION_LIMITS_ERROR:
        case CApAPPLimitError.LimitErrorType.TRANSLATION_ROTATION_LIMITS_ERROR:
          messageToDisplay = $"{string.Format(CApAPPMainWindowStringTable.PathPlanningTranslationLimitExceeded, (object) this.InvalidOperationName)}\n{string.Format(CApAPPMainWindowStringTable.PathPlanningRotationRangeWarning, (object) this.ErrorMessage)}";
          break;
        case CApAPPLimitError.LimitErrorType.ROTATION_LIMITS_ERROR:
          messageToDisplay = $"{string.Format(CApAPPMainWindowStringTable.PathPlanningRotationLimitExceeded, (object) this.InvalidOperationName)}\n{string.Format(CApAPPMainWindowStringTable.PathPlanningRotationRangeWarning, (object) this.ErrorMessage)}";
          break;
      }
      return messageToDisplay;
    }
  }

  public string ErrorMessage
  {
    get => this.m_errorMessage;
    set
    {
      this.m_errorMessage = value;
      this.RaisePropertyChanged(nameof (ErrorMessage));
    }
  }

  public string InvalidOperationName
  {
    get => this.m_invalidOperationName;
    set
    {
      this.m_invalidOperationName = value;
      this.RaisePropertyChanged(nameof (InvalidOperationName));
    }
  }

  public List<CApAPPWaypoint> WaypointsWithTranslationError
  {
    get => this.m_waypointsWithTranslationError;
    set
    {
      this.m_waypointsWithTranslationError = value;
      this.RaisePropertyChanged(nameof (WaypointsWithTranslationError));
    }
  }

  public List<CApAPPWaypoint> WaypointsWithRotationError
  {
    get => this.m_waypointsWithRotationError;
    set
    {
      this.m_waypointsWithRotationError = value;
      this.RaisePropertyChanged(nameof (WaypointsWithRotationError));
    }
  }

  private void RaisePropertyChanged(string property)
  {
    if (this.PropertyChanged == null)
      return;
    this.PropertyChanged((object) this, new PropertyChangedEventArgs(property));
  }

  public event PropertyChangedEventHandler PropertyChanged;

  public enum LimitErrorType
  {
    NO_ERROR,
    TRANSLATION_LIMITS_ERROR,
    ROTATION_LIMITS_ERROR,
    TRANSLATION_ROTATION_LIMITS_ERROR,
  }
}
